package com.springcloud.feignconsumer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.springcloud.feignconsumer.domain.User;
import com.springcloud.feignconsumer.service.HelloService;

@RestController
public class HelloController {

	@Autowired
	HelloService helloService;

	@RequestMapping(value = "/feign", method = RequestMethod.GET)
	public String helloConsumer() {
		return helloService.hello();
	}
	
	@RequestMapping(value = "/feign2",method =RequestMethod.GET)
	public String helloConsumer2(){
		StringBuilder sb = new StringBuilder();
		sb.append(helloService.hello()).append("\n");
		sb.append(helloService.hello("yuhang")).append("\n");
		sb.append(helloService.hello(new User(1, "emin"))).append("\n");
		return sb.toString();
	}
}
